<style>
	#content {
		width: 960px;
		min-height: 800px;
		margin: 0 auto;
	}
	#goods_mouseover {
	}
	.backToTop {
		display: none;
		width: 18px;
		line-height: 1.2;
		padding: 5px 0;
		background-color: #000;
		color: #fff;
		font-size: 12px;
		text-align: center;
		position: fixed;
		_position: absolute;
		right: 10px;
		bottom: 100px;
		_bottom: "auto";
		cursor: pointer;
		opacity: .6;
		filter: Alpha(opacity=60);
	}
</style>




<div div class="goods-wall" style=" width:100%;height: 400px; opacity: 1;">
	<div class="tag-book" style="top: 2px; left: 0px; height:300px">
		
		<div class="sub-tag">
			<div class="sub-tag-list J_CardExit1 J_CurDiv" style="position:inherit">
				<ul class="clearfix">
					<li>
						<a href="/xihuan/gallery/美容美体/tag/洗手液">沙发</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/手部去角质">床</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/眼唇卸妆液">双人床</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/指甲修护">地板</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/美甲工具">电器</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/手膜">冰箱</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/指甲营养油">洗衣机</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/橄榄油">彩电</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/手部美白">空调</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/指甲油">双人沙发</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/卸妆液">组合沙发</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/指甲贴片">椅子</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/化妆棉">木头椅</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/手部保湿">靠椅</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/美甲饰品">瓷砖</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/洁面乳">油烟机</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/快干亮油">整体橱柜</a>
					</li>
					<li class="on">
						<a href="/xihuan/gallery/美容美体/tag/手工皂">手工皂</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/眼部精华">眼部精华</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/睫毛膏">睫毛膏</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/润唇膏">润唇膏</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/唇部去角质">唇部去角质</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/眼影">眼影</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/去黑头">去黑头</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/眼唇卸妆">眼唇卸妆</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/口红">口红</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/眼膜">眼膜</a>
					</li>
					<li>
						<a href="/xihuan/gallery/美容美体/tag/唇蜜">唇蜜</a>
					</li>
				</ul>
			</div>
		</div>
	</div>

	<?php

if($facilities){
$colum=0;
$row=0;
foreach ($facilities as $f){

if($row==0){
	$left=240+240*$colum;
}
else{
	$left=240*$colum;
}
	
$leftpx=$left.'px';
$top=310*$row;
$style="left:".$left.'px;'."top:".$top.'px';

	?>

	<div class="goods" id="<?php echo $colum?>" style="<?php echo $style?>">
		<div class="goods-pic" >
			<?php echo CHtml::link(CHtml::image($f->thumbPath,'',array('height'=>'210px')),
array('webgl/showFacilityDetail/','geometry'=>$f->geometry,'id'=>$f->_id,'goodsName'=>$f->goodsName,'description'=>$f->description),
array('alt'=>$f->goodsName,'title'=>$f->goodsName))
			?>
		</div>
		<div class="goods-stat clearfix">
			<span class="like-num">使用: <em class="like-count">5 </em></span>
			<span class="fr ml5">评论: 12</span>
		</div>
		<ul class="comments">
			<li>
				<?php echo $f->description
				?>
			</li>
		</ul>
	</div>
	<?php
	$colum++;
	if($row==0){
		if($colum == 3) {
		$colum = 0;
			$row++;
		}
	}
	if($colum == 4) {
		$colum = 0;
		$row++;
	}
	}
	}
	?>
</div>
<script type="text/javascript" charset="utf-8">
	$(function() {
		alert($("#content").css('width'));
// $(".goods-wall").attr('width')
		var pageNo = 2;
		var pageSize = 1;
		// alert($(document).height()-$(window).height()-200);
		// 	lazy load不好用，废止。

		// $("img").lazyload({
		// effect : "fadeIn"
		// });
		var height = $('.goods').height();
		// var height = gHeight.substring(0, gHeight.length - 2);

		var loadTag = $(document).height()-$(document).height-200;
		$('.goods').mouseover(function() {
			// alert('dd');
		});
		var row=<?php echo $row+1?>;
		$(window).scroll(function() {

			if($(this).scrollTop() > loadTag) {
				console.warn($(this).scrollTop() + ";" + loadTag);
				// if(row<=20){
					$.post(loadFacilityUrl, {
					pageNo : pageNo,
					pageSize : pageSize
				}, function(data) {
					console.warn(pageNo);
					console.warn(data);
					// $('.goods-wall').append(data);
					data=eval(data);
					var colum=0;
					for (var i =0;i<data.length;i++){
					var d=data[i];
					var left=240*colum;
					var top=310*row;
					style="left:"+left+'px;'+"top:"+top+'px';

					var goods=$("<div class=goods style="+style+"></div>");
					var url=showFacilityDetailUrl+"&geometry="+d.geometry+"&id="+d._id.$id+"&goodsName="+d.goodsName+"&description="+d.description;
					var goods_pic=$("<div class=goods-pic ><a alt="+d.goodsName+" title="+d.goodsName+" href="+url+"><img height='210px' src="+d.thumbPath+"></a></div>");
					goods.append(goods_pic);
					
					var goods_stat=$("<div class=goods-stat clearfix><span class=like-num>使用: <em class=like-count>5 </em></span><span class=fr ml5>评论: 12</span></div>");
					goods.append(goods_stat);
					
					var comment=$("<ul class=comments><li>"+d.description+"</li></ul>");
					goods.append(comment);					
					$('.goods-wall').append(goods);
					colum++;
						if(colum == 4) {
							colum = 0;
							row++;
						}
					}
					pageNo++;
					var goodsWallHeight=$(".goods-wall").height()+row*(310+10);
					$(".goods-wall").css({"height":goodsWallHeight+'px'});
				});
				// }
				
				loadTag = loadTag + height;
				console.warn($(this).scrollTop() + ";" + loadTag);
				
			}
			
			if($(this).scrollTop() > $(".m-head").height()) {
				$(".m-head").hide();
				$(".m-nav").addClass('fixed');
			} else {
				$(".m-head").show();
				$(".m-nav").removeClass('fixed');
			}
		});
	});
	
</script>
<script>
$(function() {

//此段代码没有效果，疑与其他代码冲突。 
    var $backToTopTxt = "返回顶部";
    var $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
        .text($backToTopTxt).attr("title", $backToTopTxt).click(function() {
            $("html,body").animate({ scrollTop: 300 }, 120);
    });
    var $backToTopFun = function() {
        var st = $(document).scrollTop(), winh = $(window).height();
        (st > 0)? $backToTopEle.show(): $backToTopEle.hide();
        //IE6下的定位
        if (!window.XMLHttpRequest) {
            $backToTopEle.css("top", st + winh - 166);
        }
    };
    $(window).bind("scroll", $backToTopFun);
     $backToTopFun();
});
</script>